Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add support for Playwright storageState configuration #5192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
kobenguyent merged 3 commits into codeceptjs:3.x from Samuel-StO:feat/storageState-playwright
Sep 30, 2025

Conversation

Copy link
Contributor

@Samuel-StO Samuel-StO commented Sep 18, 2025

This PR introduces a new storageState option in the Playwright helper configuration.
With this change, users can pass a Playwright storage state directly (either as a path to a JSON file or as an object) to initialize browser contexts with preloaded session data such as cookies, localStorage, IndexedDB, or authentication tokens.

Key points

  • storageState can be configured globally in codecept.conf.js or overridden per scenario.
  • Ensures Playwright handles storage state validation and errors natively.
  • Simplifies authentication and session reuse across tests.

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium
  • TestCafe

Applicable plugins:

  • allure
  • autoDelay
  • autoLogin
  • customLocator
  • pauseOnFail
  • coverage
  • retryFailedStep
  • screenshotOnFail
  • selenoid
  • stepByStepReport
  • stepTimeout
  • wdio
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Playwright's native storageState configuration to the Playwright helper, enabling users to initialize browser contexts with preloaded session data such as cookies, localStorage, and authentication tokens. The feature allows passing either a file path to a JSON storage state or a storage state object directly.

  • Adds storageState configuration option to Playwright helper
  • Implements grabStorageState() method to capture current browser state
  • Ensures scenario-level cookies override global storageState configuration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
lib/helper/Playwright.js Adds storageState config handling and grabStorageState method
test/helper/Playwright_test.js Comprehensive test coverage for storageState functionality
docs/playwright.md User guide documentation with examples and security warnings
docs/helpers/Playwright.md API reference documentation for new features

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Samuel-StO Samuel-StO force-pushed the feat/storageState-playwright branch from 7ec2752 to 1570463 Compare September 29, 2025 08:37
Copy link
Contributor Author

The fails seems due to a flaky test, it's appear on other PR (https://github.com/codeceptjs/CodeceptJS/actions/runs/17969310358/job/51108017771?pr=5211)

@kobenguyent kobenguyent merged commit 0345fc7 into codeceptjs:3.x Sep 30, 2025
14 checks passed
Copy link
Contributor Author

@kobenguyent, is it possible to create a new beta version for version 3.7.6, please? So that we can have a beta version with this feature.

Copy link
Collaborator

@kobenguyent, is it possible to create a new beta version for version 3.7.6, please? So that we can have a beta version with this feature.

@Samuel-StO sure, please allow me some time to do that. Thanks!

Copy link
Contributor Author

Yes, of course, no rush.

Copy link
Contributor Author

Thanks

Copy link
Collaborator

@Samuel-StO forgot to tell, new beta is now available. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

Copilot code review Copilot Copilot left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /